package com.github.aloxc.plugin.restplus.listener;

import com.github.aloxc.plugin.restplus.component.Dialog;
import com.github.aloxc.plugin.restplus.component.SwaggerForm;
import com.github.aloxc.plugin.restplus.i18n.I18Bundle;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;

import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class SwaggerListener extends MouseAdapter {
    private Project project;

    public SwaggerListener(Project project) {

        this.project = project;
    }

    @Override
    public void mouseClicked(MouseEvent e) {
        SwaggerForm swagger = new SwaggerForm(project);
        swagger.setMaximumSize(new Dimension(700,150));
        swagger.setMinimumSize(new Dimension(700,150));
        swagger.setPreferredSize(new Dimension(700,150));
        com.github.aloxc.plugin.restplus.component.Dialog dialog = new Dialog(null, swagger,
                new Dimension(500,150),
                new Dimension(500,150),
                new Dimension(500,150),
                IconLoader.getIcon("/icons/swagger.png"),
                I18Bundle.getMessage("com.github.aloxc.plugin.restplus.swagger.title")
        );
        dialog.setVisible(true);
    }
}